package com.ruoyi.novel.service.impl;

import java.util.List;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.ruoyi.common.utils.DateUtils;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.novel.mapper.NovelMapper;
import com.ruoyi.novel.domain.Novel;
import com.ruoyi.novel.service.INovelService;

/**
 * 小说漫画Service业务层处理
 *
 * @author 张三
 * @date 2025-04-18
 */
@Service
public class NovelServiceImpl extends ServiceImpl<NovelMapper, Novel> implements INovelService
{
    @Autowired
    private NovelMapper novelMapper;

    /**
     * 查询小说漫画
     *
     * @param id 小说漫画主键
     * @return 小说漫画
     */
    @Override
    public Novel selectNovelById(Integer id)
    {
        return novelMapper.selectNovelById(id);
    }

    /**
     * 查询小说漫画列表
     *
     * @param novel 小说漫画
     * @return 小说漫画
     */
    @Override
    public List<Novel> selectNovelList(Novel novel)
    {
        return novelMapper.selectNovelList(novel);
    }

    /**
     * 新增小说漫画
     *
     * @param novel 小说漫画
     * @return 结果
     */
    @Override
    public int insertNovel(Novel novel)
    {
        novel.setCreateTime(DateUtils.getNowDate());
        return novelMapper.insertNovel(novel);
    }

    /**
     * 修改小说漫画
     *
     * @param novel 小说漫画
     * @return 结果
     */
    @Override
    public int updateNovel(Novel novel)
    {
        novel.setUpdateTime(DateUtils.getNowDate());
        return novelMapper.updateNovel(novel);
    }

    /**
     * 批量删除小说漫画
     *
     * @param ids 需要删除的小说漫画主键
     * @return 结果
     */
    @Override
    public int deleteNovelByIds(Integer[] ids)
    {
        return novelMapper.deleteNovelByIds(ids);
    }

    /**
     * 删除小说漫画信息
     *
     * @param id 小说漫画主键
     * @return 结果
     */
    @Override
    public int deleteNovelById(Integer id)
    {
        return novelMapper.deleteNovelById(id);
    }

    @Override
    public IPage<Novel> getNovelList(IPage<Novel> page, QueryWrapper<Novel> queryWrapper) {
        return novelMapper.getNovelList(page, queryWrapper);
    }

    @Override
    public IPage<Novel> getUserNovelList(IPage<Novel> page, QueryWrapper<Novel> queryWrapper) {
        return novelMapper.getUserNovelList(page, queryWrapper);
    }

    @Override
    public IPage<Novel> getOrderNovelList(IPage<Novel> page, QueryWrapper<Novel> queryWrapper) {
        return novelMapper.getOrderNovelList(page, queryWrapper);
    }
}
